package com.contact.dao;

import java.util.Collection;
import java.util.List;
import java.util.Set;

public interface BaseDAO<T> {
    Class<T> getType();
    T getById(long id);
    List<T> getAll();
    List<T> getAllByAttribute(String attribute, Object value);
    List<T> getAllByAttributes(String[] attributes, Object[] values);
    List<T> getAllByOrAttributes(String[] attributes, Object[] values);
    List<T> getAllByIds(Set<Long> ids);
    
    T getByAttribute(String attribute, Object value);
    T getByAttributes(String[] attributes, Object[] values);
    
    /*
     * Save/persist related methods
     */
    T merge(final T bean);
    T persist(T bean);
    void saveAll(Collection<T> all);

    /*
     * Delete methods
     */
    void deleteById(long id);
    void deleteByIds(Set<Long> ids);
    void delete(T bean);
    void deleteAll(Collection<T> all);
    int getCountByAttributes(String[] attributes, Object[] values);
    
}
